home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 004 / lisajoy.bas (.txt) < prev    next >
Encoding:
GW-BASIC  |  1984-07-27  |  2.4 KB  |  68 lines

  1. 10  ' ***
  2. 20  ' *** LISSAJOUS FIGURES ***
  3. 30  ' *** Taken from Compute!'s PC&PC-jr Magazine, May 1984  Issue 3 Vol. 1 #3
  4. 40  ' *** Entered by Jim Kloss of NOCHANGE - Atlanta Ga.
  5. 50  ' *** NOCHANGE BBS Phone Number (404)587-4198
  6. 60  ' ***
  7. 70  SCREEN 1:CLS:KEY OFF
  8. 80  PRINT "Lissajous Figures":PRINT:PRINT
  9. 90  PRINT "Introduction (Y or N)?"
  10. 100  Q$=INKEY$:IF Q$="" THEN 100
  11. 110  IF Q$="Y" OR Q$="y" THEN GOSUB 440
  12. 120  CLS
  13. 130  INPUT "Frequency ratio -- (any number) :";FREQ:PRINT
  14. 140  INPUT "Phase difference (-360 to 360) :";PHASE
  15. 150  PRINT
  16. 160  PRINT "Press spacebar to freeze display!"
  17. 170  PRINT "(and again to unfreeze!)"
  18. 180  PRINT:PRINT "Press E to end."
  19. 190  LOCATE 25,1
  20. 200  PRINT "(Press any key now to start ...)";
  21. 210  IF INKEY$="" THEN 210
  22. 220  CLS
  23. 230  LOCATE 1,1:PRINT "1:";FREQ
  24. 240  LOCATE 3,1:PRINT PHASE
  25. 250  PRINT "Degrees"
  26. 260  PI=3.14159:FACTOR=180/PI
  27. 270  PHASE=PHASE/FACTOR
  28. 280  DEF FNX(Q)=160+90*SIN(Q)
  29. 290  DEF FNY(Q)=100+90*SIN(Q)
  30. 300  '*** Plot first two points ***
  31. 310  LINE (FNX(0),FNY(FREQ*PHASE))-(FNX(0.1),FNY(FREQ*(0.1+PHASE))),2
  32. 320  THETA=0.2
  33. 330  LINE -(FNX(THETA),FNY(FREQ*(THETA+PHASE))),2
  34. 340  THETA=THETA+0.05
  35. 350  Q$=INKEY$
  36. 360  IF Q$<>" " THEN 380
  37. 370  IF INKEY$="" THEN 370
  38. 380  IF Q$<>"E" AND Q$<>"e" THEN 330
  39. 390  CLS:PRINT "Another (Y or N)?"
  40. 400  Q$=INKEY$
  41. 410  IF Q$="" THEN 400
  42. 420  IF Q$="Y" OR Q$="y" THEN 70
  43. 430  CLS:KEY ON:SCREEN 0:WIDTH 80:END
  44. 440  SCREEN 0:WIDTH 80
  45. 450  PRINT "   Here is a program that draws Lissajous figures on the screen"
  46. 460  PRINT "of an IBM-PC or PCjr.  It traces out the path of a point described"
  47. 470  PRINT "by two sine-wave functions whose phase and frequency relationship is"
  48. 480  PRINT "specified by the user.
  49. 490  PRINT "   Fortunately, you don't have to know anything about sine-wave
  50. 500  PRINT "functions to use the program.  Just think of it as asking for two
  51. 510  PRINT "numbers: a frequency ratio, which can be any nonzero number, and
  52. 520  PRINT "a phase angle, which is measured in degrees (all possible values
  53. 530  PRINT "occur in the range 0 to 360, though you can enter any number that
  54. 540  PRINT "you want!)  Start with a frequency ratio of 1 and experiment with
  55. 550  PRINT "changing the phase angle: 0, 45, 90, 180, and so forth.  Then try
  56. 560  PRINT "whole number frequency ratios: 2, 3, 4.  Finally, try varying both
  57. 570  PRINT "frequency ratio and phase angle in any way that you like!
  58. 580  PRINT "   Some good ones to start with are:
  59. 590  PRINT "Freq = 1.3  Degrees = 60
  60. 600  PRINT "Freq = 1.05 Degrees = 60
  61. 610  PRINT "Freq = .801 Degrees = 0
  62. 620  PRINT "Freq = 1.05 Degrees = 180
  63. 630  PRINT:PRINT
  64. 640  PRINT "Hit any key to continue ..."
  65. 650  Q$=INKEY$:IF Q$="" THEN 650
  66. 660  SCREEN 1
  67. 670  RETURN
  68.